<?php

	/* Add Captcha Information Here */
	/* We can not include this package in our distribution, but you can download it yoruself free */
	/* http://code.google.com/apis/recaptcha/docs/php.html */

	/* START CAPTCHA COMMENT
	include_once('libraries/third-party/recaptchalib.php');
	
	$publickey = $this->$key_recaptcha; 
	$captcha = recaptcha_get_html($publickey);
			
	if($_SESSION['form']['captcha_challenge'] == 'Failed')
	{
		$captcha_fail = '<div id="captcha_fail" style="margin-bottom: 20px;">Please retry the captcha</div>';
	} else {
		$captcha_fail = NULL;
	} 
	END CAPTCHA COMMENT */
?>

<script>
	/* Add Captcha Information Here */
	/* These lines for reCaptcha won't do any harm if left uncommented. */
	// var RecaptchaOptions = {
   	// theme : 'white'
	// };

function error_chk()
	{

		var errors = '';
		
		if(!document.getElementById('fname').value)
		{
			errors += '- Name Missing\n';
		}
		
		if(!document.getElementById('email').value)
		{
			errors += '- Email Missing\n';
		}
		
		if(!document.getElementById('message').value)
		{
			errors += '- Message Missing\n';
		}
		
		if(errors != '')
		{
			alert('ERRORS\n' + errors);
			return false;
		}
		
	}
</script>

<h1>contact</h1>
<p style="margin-top: -10px">take a minute and complete the form below</p>

<form action="/contact_form/submit/" name="contact_form" id="contact_form" method="post" onsubmit="return error_chk();">
<input type="hidden" name="subject" value="MSG FROM PASTEBOARD.ORG DEV-SITE" />
<input type="hidden" name="no_captcha" value="0" />

<p style="padding-top: 10px;">
Name:<br />
<input type="text" id="fname" name="name" size="60" value="<?= $_SESSION['form']['name'] ?>" />
</p>

<p style="padding-top: 10px;">
Email:<br />
<input type="text" id="email" name="email" size="60" value="<?= $_SESSION['form']['email'] ?>" />
</p>

<p style="padding-top: 10px;">
Message:<br />
<textarea name="message" id="message" cols="80" rows="10"><?= $_SESSION['form']['msg'] ?></textarea>
</p>

<p style="padding-top: 10px;">
<?= $captcha_fail ?>
<?= $captcha ?>
</p>

<p style="padding-top: 20px; padding-bottom: 40px;">
<input type="submit" value="Submit"/> <a href="/">cancel</a>
</p>

</form>
</div> <!-- for captcha padding weirdness -->

<? 	unset($_SESSION['form']); ?>